//
//  LXGreenBeansCountViewCell.m
//  LvXi_newVersion
//
//  Created by 诸葛孔明 on 16/9/6.
//  Copyright © 2016年 SJT. All rights reserved.
//

#import "LXGreenBeansCountViewCell.h"

@interface LXGreenBeansCountViewCell()
/**使用帮助*/
@property (nonatomic,weak) UIButton *useHelpBtn;
/**介绍*/
@property (nonatomic,weak) UILabel *introduceLabel;
/**个*/
@property (nonatomic,weak) UILabel *wordLabel;

@end

@implementation LXGreenBeansCountViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        UIButton *useHelpBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [useHelpBtn setTitle:@"使用帮助" forState:UIControlStateNormal];
        [useHelpBtn setTitleColor:HexColor(@"#999999") forState:UIControlStateNormal];
        useHelpBtn.titleLabel.font = [UIFont systemFontOfSize:11];
        [useHelpBtn addTarget:self action:@selector(useHelpClick) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:useHelpBtn];
        self.useHelpBtn = useHelpBtn;
        
        UILabel *introduceLabel = [[UILabel alloc] init];
        introduceLabel.textColor = HexColor(@"#999999");
        introduceLabel.font = [UIFont systemFontOfSize:11];
        introduceLabel.text = @"小小绿豆,大大用处,多领一些囤起来吧!";
        [self addSubview:introduceLabel];
        self.introduceLabel = introduceLabel;
        
        UILabel *wordLabel = [[UILabel alloc] init];
        wordLabel.font = [UIFont systemFontOfSize:15];
        wordLabel.textColor = HexColor(@"#3CB034");
        wordLabel.text = @"个";
        [self addSubview:wordLabel];
        self.wordLabel = wordLabel;
        
        UILabel *countLabel = [[UILabel alloc] init];
        countLabel.font = [UIFont systemFontOfSize:25];
        countLabel.textColor = HexColor(@"#3CB034");      
        [self addSubview:countLabel];
        self.countLabel = countLabel;
        
        [self setBackgroundImageViewHeight:MineRatio(125)];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    //使用帮助
    self.useHelpBtn.width = MineRatio(60);
    self.useHelpBtn.height = MineRatio(16);
    self.useHelpBtn.x = self.width - self.useHelpBtn.width - MineRatio(10);
    self.useHelpBtn.y = MineRatio(15);
    
    //小小绿豆.....
    self.introduceLabel.width = [self.introduceLabel.text sizeInAre:MaxSize font:self.introduceLabel.font].width;
    self.introduceLabel.height = [self.introduceLabel.text sizeInAre:MaxSize font:self.introduceLabel.font].height;
    self.introduceLabel.x = (self.width - self.introduceLabel.width) * 0.5;
    self.introduceLabel.y = self.height - self.introduceLabel.height - MineRatio(16);
    
    //绿豆个数
    self.countLabel.width = [self.countLabel.text sizeInAre:MaxSize font:self.countLabel.font].width;
    self.countLabel.height = [self.countLabel.text sizeInAre:MaxSize font:self.countLabel.font].height;
    self.countLabel.x = (self.width - self.countLabel.width) * 0.5;
    self.countLabel.y = self.introduceLabel.top - MineRatio(25) - self.countLabel.height;
    
    //个
    self.wordLabel.width = [self.wordLabel.text sizeInAre:MaxSize font:self.wordLabel.font].width;
    self.wordLabel.height = [self.wordLabel.text sizeInAre:MaxSize font:self.wordLabel.font].height;
    self.wordLabel.x = self.countLabel.right;
    self.wordLabel.botton = self.countLabel.botton - MineRatio(3);
}

- (void)useHelpClick
{
    
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

@end
